package com.lei.huawei;

import java.util.*;
//
//HJ92 在字符串中找出连续最长的数字串
public class LongestStr {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        while (scanner.hasNext()){
            String str = scanner.nextLine();
            get(str);

        }
        scanner.close();
    }
    public static void get(String s){
        char[] ch = s.toCharArray();
        int len = ch.length;
        int count = 0;
        Map<String, Integer> map = new LinkedHashMap<>();
        for (int i = 0; i < len -1; i++) {
            if(Character.isDigit(ch[i])){
                count++;
                int j = i +1;
                while(j<=len-1 && Character.isDigit(ch[j])){
                    count++;
                    j++;
                }
                i = i + count - 1;
                map.put(s.substring(i-count+1,i +1),count);
                count = 0;
            }else {
                continue;
            }
        }
        int max = 0;
        int a = 0;
        for (String key : map.keySet()) {
            max = Math.max(max,map.get(key));
        }
        for (String key : map.keySet()) {
            if(map.get(key) == max){
                a++;
                System.out.print(key);
            }
        }
        System.out.println(","+max);

    }
}
